package com.example.controller;

import com.example.entity.RestBean;
import com.example.entity.auth.UserInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttribute;

@RestController
@RequestMapping("/api/user")
public class UserController {
    @GetMapping("/info")
    public RestBean<UserInfo> getUserInfo(@SessionAttribute("userInfo") UserInfo user){ // @SessionAttribute注解，从session中获取userInfo
        return RestBean.success(user);
    }
}
